import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';



// 静态路由
export const constantRoutes: RouteRecordRaw[] = [
  {
    path: '/hello',
    name:'/hello',
    component: () => import('@/components/HelloWorld.vue'),
  },
  {
    path: '/login',
    component: () => import('@/components/Login.vue'),
  },
  
];


/**
 * 创建路由
 */
const router = createRouter({
  history: createWebHashHistory(),
  routes: constantRoutes as RouteRecordRaw[],
  // 刷新时，滚动条位置还原
  scrollBehavior: () => ({ left: 0, top: 0 }),
});
export function resetRouter() {
  router.replace({ path: '/login' });
}

export default router;
